{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "189fbaca",
   "metadata": {},
   "source": [
    "---\n",
    "* 2023-11-1\n",
    "* 课程：Python语言\n",
    "* week07\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d32abcf3",
   "metadata": {},
   "source": [
    "# 本周内容\n",
    "\n",
    "## 1. 列表的概念\n",
    "\n",
    "## 2. 列表的性质\n",
    "\n",
    "## 3. 列表的一般方法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b676339",
   "metadata": {},
   "source": [
    "# 1. 列表的概念"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8f3c6658",
   "metadata": {},
   "source": [
    "* 思考：如果我们想要存放一个班级的同学名字，目前我们有什么样方法？\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c5a3d68e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "小明 张三 小红 李晓明\n"
     ]
    }
   ],
   "source": [
    "# 第一种方法\n",
    "\n",
    "name01 = \"小明\"\n",
    "name02 = \"张三\"\n",
    "name03 = \"小红\"\n",
    "name04 = \"李晓明\"\n",
    "print(name01,name02,name03,name04)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "eabb3627",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "小明 张三 小红 李晓明\n"
     ]
    }
   ],
   "source": [
    "# 第二种方式\n",
    "name = \"小明 张三 小红 李晓明\"\n",
    "print(name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "43476c67",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'小红'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 尝试取值：小红\n",
    "name[6:8]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86ba4f8a",
   "metadata": {},
   "source": [
    "* 综上所述，列表就诞生了"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "4a64f43d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['小明', '张三', '小红', '李晓明']\n",
      "<class 'list'>\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"小明\",\"张三\",\"小红\",\"李晓明\"]\n",
    "print(name_list)\n",
    "print(type(name_list))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "376d6462",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'小红'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[2]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "451c5e83",
   "metadata": {},
   "source": [
    "# 2. 列表的性质"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "956177aa",
   "metadata": {},
   "source": [
    "## 2.1 列表的有序性 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "eb660844",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'小明'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "06baa723",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'张三'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[1]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3dc8eb9f",
   "metadata": {},
   "source": [
    "## 2.2 列表的可变性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "494ffb5b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', '张三', '小红', '李晓明']"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "95eee3f6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', '张三', '小红', '李树人']"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list[3] = \"李树人\"\n",
    "name_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9281b952",
   "metadata": {},
   "source": [
    "## 2.3 列表存放不同的数据结构的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "a2181b8e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', 18, '张三', 19, '小红', 18, '李树人', 20]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_age_list = ['小明',18, '张三',19 ,'小红',18, '李树人',20]\n",
    "name_age_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "98d3ee68",
   "metadata": {},
   "source": [
    "## 2.4 列表重复性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3b129947",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[95, 90, 95, 92, 88, 90, 93, 95]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python = [95,90,95,92,88,90,93,95]\n",
    "网新_python"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "67a000f2",
   "metadata": {},
   "source": [
    "# 3. 列表的方法\n",
    "\n",
    "> 1. 列表的创建\n",
    ">> 1. 直接用[]创建列表，中间的元素用 英文的 ,隔开\n",
    ">> 2. 使用 list() 创建列表\n",
    "> 2. 列表的处理\n",
    ">> 1. 取值\n",
    ">> 2. 查询\n",
    ">> 3. 增加\n",
    ">> 4. 删除"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "98239f85",
   "metadata": {},
   "source": [
    "## 3.1 列表的创建"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "9c7e1d1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 使用list() 列表构造器创建列表\n",
    "my_list1 = list((1,2,3))\n",
    "my_list1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "daf8aaf8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3]\n"
     ]
    }
   ],
   "source": [
    "my_list2 = [1, 2, 3]\n",
    "print(my_list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "85033386",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 创建空列表\n",
    "my_list3 = list()\n",
    "my_list3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "4c5d4446",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_list4 = []\n",
    "my_list4"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b39d4d4b",
   "metadata": {},
   "source": [
    "## 3.2 列表的方法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f8e0965a",
   "metadata": {},
   "source": [
    "### 1. 列表的取值\n",
    "\n",
    "> 1. index 取单个值\n",
    "> 2. 切片 截取多个值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "58b0389e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['小明', '张三', '小红', '李晓明']\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"小明\",\"张三\",\"小红\",\"李晓明\"]\n",
    "print(name_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "664a1115",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'张三'"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 取出 张三 同学的名字\n",
    "name_list[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "e503fa37",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小红', '李晓明']"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 通过切片取出后两位同学\n",
    "name_list[-2:]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d71ca43a",
   "metadata": {},
   "source": [
    "### 2. 列表的查询 和 长度\n",
    "\n",
    "* in 方法作为python的一个特殊方法，不仅可以在列表数据使用，其他数据也可\n",
    "* len() 对数据长度（范围）进行查询，不仅可以在列表数据使用，其他数据也可"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "6aa66b2c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"小红\" in name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "e7dedc62",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"小鹏\" in name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "7a45b8dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(name_list)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1a685c63",
   "metadata": {},
   "source": [
    "### 3. 关于列表的新增\n",
    "\n",
    "> 1. append() 增加\n",
    "> 2. insert() 插入、嵌入\n",
    "> 3. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "c40880a4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['小明', '张三', '小红', '李晓明']\n"
     ]
    }
   ],
   "source": [
    "name_list = [\"小明\",\"张三\",\"小红\",\"李晓明\"]\n",
    "print(name_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "714abb8f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', '张三', '小红', '李晓明', 'Dainel']"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list.append(\"Dainel\")\n",
    "name_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "c7acaea4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function append:\n",
      "\n",
      "append(object, /) method of builtins.list instance\n",
      "    Append object to the end of the list.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(name_list.append)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "23ce3af5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function insert:\n",
      "\n",
      "insert(index, object, /) method of builtins.list instance\n",
      "    Insert object before index.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# insert\n",
    "help(name_list.insert)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "2cf6bcb2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['小明', '张三', 'Marry', '小红', '李晓明', 'Dainel']"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list.insert(2,\"Marry\")\n",
    "name_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cfd2e987",
   "metadata": {},
   "source": [
    "* 临时将一个方法：count() 统计某个元素在列表中出现的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "800463d0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[95, 90, 95, 92, 88, 90, 93, 95]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python = [95,90,95,92,88,90,93,95]\n",
    "网新_python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "e2bfc400",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_python.count(95)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "062e3782",
   "metadata": {},
   "source": [
    "* 综合实践：\n",
    "* 投骰子1000次，分别统计每一个骰子面出现的次数\n",
    "> 1. 创建一个空列表\n",
    "> 2. 通过append方法将每一次产生的骰子数存进去\n",
    "> 3. 通过count方法查询每一骰子面的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "e4100a27",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1000\n",
      "[2, 2, 5, 6, 5, 2, 1, 3, 5, 3, 6, 1, 6, 3, 4, 2, 1, 3, 1, 3, 6, 3, 5, 2, 1, 1, 6, 6, 2, 6, 4, 2, 2, 3, 6, 4, 6, 2, 6, 3, 4, 4, 1, 1, 5, 4, 1, 6, 6, 6, 3, 1, 2, 3, 2, 3, 5, 1, 1, 1, 4, 6, 4, 4, 2, 2, 3, 2, 5, 2, 3, 1, 5, 5, 2, 5, 1, 3, 4, 3, 6, 6, 6, 2, 1, 2, 1, 6, 2, 4, 6, 5, 6, 1, 2, 4, 2, 1, 3, 2, 2, 6, 1, 6, 4, 3, 4, 4, 6, 4, 2, 3, 3, 4, 6, 4, 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 4, 5, 1, 5, 3, 2, 6, 4, 2, 4, 6, 4, 4, 6, 1, 5, 4, 6, 4, 2, 5, 4, 3, 5, 3, 5, 4, 1, 4, 6, 3, 5, 5, 6, 6, 1, 5, 5, 2, 4, 6, 6, 3, 5, 2, 3, 4, 5, 1, 3, 3, 4, 3, 4, 5, 2, 2, 1, 1, 3, 3, 2, 3, 3, 2, 2, 1, 4, 6, 4, 6, 5, 3, 6, 3, 4, 2, 6, 4, 6, 6, 2, 4, 5, 4, 3, 2, 2, 2, 6, 3, 2, 3, 1, 4, 4, 5, 1, 5, 3, 6, 4, 1, 6, 3, 2, 4, 1, 1, 2, 4, 1, 6, 4, 2, 4, 1, 2, 4, 1, 1, 4, 4, 4, 1, 3, 1, 3, 6, 2, 1, 2, 4, 4, 1, 4, 3, 2, 6, 1, 6, 1, 1, 4, 1, 1, 6, 6, 3, 5, 4, 3, 5, 1, 6, 6, 5, 3, 3, 6, 6, 3, 3, 1, 1, 1, 1, 4, 4, 1, 3, 4, 2, 3, 6, 6, 1, 5, 2, 2, 5, 5, 5, 2, 2, 5, 1, 6, 2, 4, 3, 3, 2, 4, 5, 4, 3, 4, 2, 3, 6]\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "骰子出现的数值列表 = []\n",
    "for i in range(1000):\n",
    "    骰子出现的数值列表.append(random.randint(1,6))\n",
    "#     print(random.randint(1,6))\n",
    "print(len(骰子出现的数值列表)) # 看下列表的长度\n",
    "print(骰子出现的数值列表)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "2a7b4b94",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 159\n",
      "2 181\n",
      "3 169\n",
      "4 164\n",
      "5 153\n",
      "6 174\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,7):\n",
    "    print(i,骰子出现的数值列表.count(i))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "14d11ce9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function count:\n",
      "\n",
      "count(value, /) method of builtins.list instance\n",
      "    Return number of occurrences of value.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(骰子出现的数值列表.count)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ef7d85ba",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "|方法名称 |  使用说明 |注意事项 | 案例 |\n",
    "|:---:|:---:|:----:|:----:|\n",
    "| append()方法| 在列表的末尾新增元素 | 可以新建空列表，然后通过新增数据的方式创建数据列表 |name_list.append(\"Dainel\") |\n",
    "| insert()方法| insert(index, object, /) method of builtins.list instance Insert object before index.| before index | name_list.insert(2,\"Marry\")|\n",
    "|count()|count(value, /) method of builtins.list instance Return number of occurrences of value. | 如果value不存在? |骰子出现的数值列表.count(1) |"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "75b11c1e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
